// Package {% .table.PackageName %}
// @Link  https://github.com/huagelong/devinggo
// @Copyright  Copyright (c) 2024 devinggo
// @Author  Kai <hpuwang@gmail.com>
// @License  https://github.com/huagelong/devinggo/blob/master/LICENSE

package {% .table.PackageName %}

import (
    "devinggo/internal/model"
    "devinggo/internal/model/page"
    "devinggo/modules/{% .table.ModuleName %}/model/req"
    "devinggo/modules/{% .table.ModuleName %}/model/res"
    "github.com/gogf/gf/v2/frame/g"
{% if contains .generateMenus "import"  %}
    "github.com/gogf/gf/v2/net/ghttp"
{% end %}
)

{% if eq .table.Type "single"  %}
type Index{% .tableCaseCamelName %}Req struct {
    g.Meta `path:"/{% .tableCaseCamelLowerName %}/index" method:"get" tags:"{% .table.TableComment %}" summary:"分页列表" x-permission:"{% .table.PackageName %}:{% .tableCaseCamelLowerName %}:index" `
    model.AuthorHeader
    model.PageListReq
    req.{% .tableCaseCamelName %}Search
}

type Index{% .tableCaseCamelName %}Res struct {
    g.Meta `mime:"application/json"`
    page.PageRes
    Items []res.{% .tableCaseCamelName %} `json:"items"  dc:"list" `
}

type List{% .tableCaseCamelName %}Req struct {
    g.Meta `path:"/{% .tableCaseCamelLowerName %}/list" method:"get" tags:"{% .table.TableComment %}" summary:"列表" x-permission:"{% .table.PackageName %}:{% .tableCaseCamelLowerName %}:list" `
    model.AuthorHeader
    model.ListReq
    req.{% .tableCaseCamelName %}Search
}

type List{% .tableCaseCamelName %}Res struct {
    g.Meta `mime:"application/json"`
    Data   []res.{% .tableCaseCamelName %} `json:"data"  dc:"list" `
}


{% end %}

{% if eq .table.Type "tree"  %}
type TreeIndex{% .tableCaseCamelName %}Req struct {
    g.Meta `path:"/{% .tableCaseCamelLowerName %}/index" method:"get" tags:"{% .table.TableComment %}" summary:"分页列表" x-permission:"{% .table.PackageName %}:{% .tableCaseCamelLowerName %}:index" `
    model.AuthorHeader
    model.ListReq
    req.{% .tableCaseCamelName %}Search
}

type TreeIndex{% .tableCaseCamelName %}Res struct {
    g.Meta `mime:"application/json"`
    Data []res.{% .tableCaseCamelName %}Tree `json:"data"  dc:"tree list" `
}

type Tree{% .tableCaseCamelName %}Req struct {
    g.Meta `path:"/{% .tableCaseCamelLowerName %}/tree" method:"get" tags:"{% .table.TableComment %}" summary:"前端选择树（不需要权限）" x-exceptAuth:"true" x-permission:"{% .table.PackageName %}:{% .tableCaseCamelLowerName %}:tree" `
    model.AuthorHeader
    model.ListReq
    req.{% .tableCaseCamelName %}Search
}

type Tree{% .tableCaseCamelName %}Res struct {
    g.Meta `mime:"application/json"`
    Data   []res.{% .tableCaseCamelName %}SelectTree `json:"data"  dc:"tree list" `
}

{% end %}

{% if contains .generateMenus "save"  %}
type Save{% .tableCaseCamelName %}Req struct {
    g.Meta `path:"/{% .tableCaseCamelLowerName %}/save" method:"post" tags:"{% .table.TableComment %}" summary:"新增" x-permission:"{% .table.PackageName %}:{% .tableCaseCamelLowerName %}:save"`
    model.AuthorHeader
    req.{% .tableCaseCamelName %}Save
}

type Save{% .tableCaseCamelName %}Res struct {
    g.Meta `mime:"application/json"`
    Id     uint64 `json:"id" dc:"id"`
}
{% end %}

{% if contains .generateMenus "read"  %}
type Read{% .tableCaseCamelName %}Req struct {
    g.Meta `path:"/{% .tableCaseCamelLowerName %}/read/{Id}" method:"get" tags:"{% .table.TableComment %}" summary:"获取单个信息" x-permission:"{% .table.PackageName %}:{% .tableCaseCamelLowerName %}:read"`
    model.AuthorHeader
    Id uint64 `json:"id" dc:"{% .table.TableComment %} id" v:"required|min:1#Id不能为空"`
}

type Read{% .tableCaseCamelName %}Res struct {
    g.Meta `mime:"application/json"`
    Data   res.{% .tableCaseCamelName %} `json:"data" dc:"信息数据"`
}
{% end %}

{% if contains .generateMenus "update"  %}
type Update{% .tableCaseCamelName %}Req struct {
    g.Meta `path:"/{% .tableCaseCamelLowerName %}/update/{Id}" method:"put" tags:"{% .table.TableComment %}" summary:"更新" x-permission:"{% .table.PackageName %}:{% .tableCaseCamelLowerName %}:update"`
    model.AuthorHeader
    req.{% .tableCaseCamelName %}Update
}

type Update{% .tableCaseCamelName %}Res struct {
    g.Meta `mime:"application/json"`
}
{% end %}

{% if contains .generateMenus "delete"  %}
type Delete{% .tableCaseCamelName %}Req struct {
    g.Meta `path:"/{% .tableCaseCamelLowerName %}/delete" method:"delete" tags:"{% .table.TableComment %}" summary:"删除" x-permission:"{% .table.PackageName %}:{% .tableCaseCamelLowerName %}:delete"`
    model.AuthorHeader
    Ids []uint64 `json:"ids" dc:"ids" v:"min-length:1#Id不能为空"`
}

type Delete{% .tableCaseCamelName %}Res struct {
    g.Meta `mime:"application/json"`
}

{% end %}

{% if contains .generateMenus "recycle"  %}

type Recycle{% .tableCaseCamelName %}Req struct {
    g.Meta `path:"/{% .tableCaseCamelLowerName %}/recycle" method:"get" tags:"{% .table.TableComment %}" summary:"回收站列表" x-permission:"{% .table.PackageName %}:{% .tableCaseCamelLowerName %}:recycle" `
    model.AuthorHeader
    model.PageListReq
    req.{% .tableCaseCamelName %}Search
}

type Recycle{% .tableCaseCamelName %}Res struct {
    g.Meta `mime:"application/json"`
    page.PageRes
    Items []res.{% .tableCaseCamelName %} `json:"items"  dc:"list" `
}
{% if contains .generateMenus "tree"  %}
type TreeRecycle{% .tableCaseCamelName %}Req struct {
    g.Meta `path:"/{% .tableCaseCamelLowerName %}/recycleList" method:"get" tags:"{% .table.TableComment %}" summary:"分页列表" x-permission:"{% .table.PackageName %}:{% .tableCaseCamelLowerName %}:recycle" `
    model.AuthorHeader
    model.ListReq
    req.{% .tableCaseCamelName %}Search
}

type TreeRecycle{% .tableCaseCamelName %}Res struct {
    g.Meta `mime:"application/json"`
    Data []res.{% .tableCaseCamelName %}Tree `json:"data"  dc:"tree list" `
}
{% end %}

type RealDelete{% .tableCaseCamelName %}Req struct {
    g.Meta `path:"/{% .tableCaseCamelLowerName %}/realDelete" method:"delete" tags:"{% .table.TableComment %}" summary:"单个或批量真实删除 （清空回收站）" x-permission:"{% .table.PackageName %}:{% .tableCaseCamelLowerName %}:realDelete"`
    model.AuthorHeader
    Ids []uint64 `json:"ids" dc:"ids" v:"min-length:1#Id不能为空"`
}

type RealDelete{% .tableCaseCamelName %}Res struct {
    g.Meta `mime:"application/json"`
}

type Recovery{% .tableCaseCamelName %}Req struct {
        g.Meta `path:"/{% .tableCaseCamelLowerName %}/recovery" method:"put" tags:"{% .table.TableComment %}" summary:"单个或批量恢复在回收站的" x-permission:"{% .table.PackageName %}:{% .tableCaseCamelLowerName %}:recovery"`
        model.AuthorHeader
        Ids []uint64 `json:"ids" dc:"ids" v:"min-length:1#Id不能为空"`
}

type Recovery{% .tableCaseCamelName %}Res struct {
        g.Meta `mime:"application/json"`
}

{% end %}

{% if contains .generateMenus "export"  %}
type Export{% .tableCaseCamelName %}Req struct {
    g.Meta `path:"/{% .tableCaseCamelLowerName %}/export" method:"post" tags:"{% .table.TableComment %}" summary:"导出" x-permission:"{% .table.PackageName %}:{% .tableCaseCamelLowerName %}:export"`
    model.AuthorHeader
    model.ListReq
    req.{% .tableCaseCamelName %}Search
}

type Export{% .tableCaseCamelName %}Res struct {
    g.Meta `mime:"application/json"`
}
{% end %}

{% if contains .generateMenus "import"  %}
type Import{% .tableCaseCamelName %}Req struct {
    g.Meta `path:"/{% .tableCaseCamelLowerName %}/import" method:"post" mime:"multipart/form-data" tags:"{% .table.TableComment %}" summary:"导入" x-permission:"{% .table.PackageName %}:{% .tableCaseCamelLowerName %}:import"`
    model.AuthorHeader
    File *ghttp.UploadFile `json:"file" type:"file"  dc:"pls upload file"`
}

type Import{% .tableCaseCamelName %}Res struct {
    g.Meta `mime:"application/json"`
}

type DownloadTemplate{% .tableCaseCamelName %}Req struct {
    g.Meta `path:"/{% .tableCaseCamelLowerName %}/downloadTemplate" method:"post,get" tags:"{% .table.TableComment %}" summary:"下载导入模板." x-exceptAuth:"true" x-permission:"{% .table.PackageName %}:{% .tableCaseCamelLowerName %}:downloadTemplate"`
    model.AuthorHeader
}

type DownloadTemplate{% .tableCaseCamelName %}Res struct {
    g.Meta `mime:"application/json"`
}

{% end %}

{% if contains .generateMenus "changeStatus"  %}
type ChangeStatus{% .tableCaseCamelName %}Req struct {
    g.Meta `path:"/{% .tableCaseCamelLowerName %}/changeStatus" method:"put" tags:"{% .table.TableComment %}" summary:"更改状态" x-permission:"{% .table.PackageName %}:{% .tableCaseCamelLowerName %}:changeStatus"`
    model.AuthorHeader
    Id     uint64 `json:"id" dc:"ids" v:"min:1#Id不能为空"`
    Status int    `json:"status" dc:"status" v:"min:1#状态不能为空"`
}

type ChangeStatus{% .tableCaseCamelName %}Res struct {
    g.Meta `mime:"application/json"`
}
{% end %}

{% if contains .generateMenus "numberOperation"  %}
type NumberOperation{% .tableCaseCamelName %}Req struct {
    g.Meta `path:"/{% .tableCaseCamelLowerName %}/numberOperation" method:"put" tags:"{% .table.TableComment %}" summary:"数字运算操作" x-permission:"{% .table.PackageName %}:{% .tableCaseCamelLowerName %}:update"`
    model.AuthorHeader
    Id          uint64 `json:"id" dc:"ids" v:"min:1#Id不能为空"`
    NumberName  string `json:"numberName" dc:"numberName" v:"required#名称不能为空"`
    NumberValue int    `json:"numberValue" dc:"number Value" d:"1" v:"min:1#数字不能为空"`
}

type NumberOperation{% .tableCaseCamelName %}Res struct {
    g.Meta `mime:"application/json"`
}
{% end %}

type Remote{% .tableCaseCamelName %}Req struct {
    g.Meta `path:"/{% .tableCaseCamelLowerName %}/remote" method:"post" tags:"{% .table.TableComment %}" summary:"远程万能通用列表接口" x-exceptAuth:"true" x-permission:"{% .table.PackageName %}:{% .tableCaseCamelLowerName %}:remote"`
    model.AuthorHeader
    model.PageListReq
}

type Remote{% .tableCaseCamelName %}Res struct {
    g.Meta `mime:"application/json"`
    page.PageRes
    Items []res.{% .tableCaseCamelName %} `json:"items"  dc:"list" `
    Data  []res.{% .tableCaseCamelName %} `json:"data"  dc:"list" `
}

